public class Main {
    public static void main(String[] args) {
        // 创建包含不同图形对象的数组
        Shape[] shapes = {
                new Circle(5.00),
                new Rectangle(4, 6),
                new Triangle(3, 4, 5)
        };
        // 遍历数组，调用每个对象的面积与周长计算方法，并输出结果
        for (Shape shape : shapes) {
            if (shape instanceof Circle) {
                System.out.println("圆形：");
                // 保留三位小数输出圆形的面积和周长
                System.out.printf("面积：%.3f\n", shape.calcArea());
                System.out.printf("周长：%.3f\n", shape.calcPerimeter());
            } else if (shape instanceof Rectangle) {
                System.out.println("矩形：");
                System.out.println("面积：" + shape.calcArea());
                System.out.println("周长：" + shape.calcPerimeter());
            } else if (shape instanceof Triangle) {
                System.out.println("三角形：");
                System.out.println("面积：" + shape.calcArea());
                System.out.println("周长：" + shape.calcPerimeter());
            }
            System.out.println();
        }
    }
}